<div class="page-header">
  <h1 class="page-title">
    <a href="<%= shop_skus_path %>">
      <%= @sku.name %>
    </a>
  </h1>
  <div class="page-subtitle"></div>
</div>
<div class="row row-cards">
  <div class="col-sm-6 col-lg-4">
    <div class="card p-3" style="height:250px;">
      <a onclick="$('input[id=sku_image_file]').click();" class="mb-3" style="text-align: center;line-height:220px">
        <%= image_tag("new_upload_ file.png", class: "rounded") %>
      </a>
      <%= form_for [:shop, @sku, SkuImage.new] do |f| %>
        <%= f.file_field :image, id: "sku_image_file", style: "display:none;", onchange: "this.form.submit();" %>
      <% end %>
    </div>
  </div>
  <% @sku_images.each_with_index do |image, index| %>
  <div class="col-sm-6 col-lg-4">
    <div class="card p-3" style="height:250px;">
      <a href="javascript:void(0)" class="mb-3">
        <img src="<%= image.image.url %>" alt="Photo by Nathan Guerrero" class="rounded">
      </a>
      <div class="d-flex align-items-center px-2">
        <div>
          <div>排序</div>
          <small class="d-block text-muted"><%= index + 1 %></small>
        </div>
        <div class="ml-auto text-muted">
          <%= link_to shop_sku_sku_image_path(@sku, image), method: :delete, class: 'icon' do %>
            <i class="fe fe-trash-2 mr-1"></i> 删除
          <% end %>
        </div>
      </div>
    </div>
  </div>
  <% end %>
</div>